home *** CD-ROM | disk | FTP | other *** search
- ;this is a program which demonstrates what is in my article.
- ;This program was written by Gavin Estey on 17.1.95. It is public domain.
-
- .MODEL SMALL
- .CODE
- Start: ;a good place to start.
- ASSUME CS:@CODE, DS:@CODE ;don't worry about this for now
-
- mov dx,offset StartUpMessage ;display a message on the screen
- mov ah,9 ;using function 09h
- int 21h ;of interrupt 21h
- mov dx,offset Instructions ;display a message on the screen
- mov ah,9 ;using function 09h
- int 21h ;of interrupt 21h
- mov ah,0 ;function 00h of
- int 16h ;interrupt 16h gets a character from user
- mov bl,al ;save bl
- mov dl,al ;move ascii value of key pressed to dl
- mov ah,02h ;function 02h of
- int 21h ;interrupt 21h displays a char to screen
- cmp bl,'Y' ;is al=Y?
- je PrintThanks ;if yes then goto PrintThanks
- jmp TheEnd
- PrintThanks:
- mov dx,offset Thanks ;display message
- mov ah,9 ;using function 9
- int 21h ;of interrupt 21h
- TheEnd:
- mov dx,offset GoodBye ;print goodbye message
- mov ah,9 ;using function 9
- int 21h ;of interrupt 21h
- mov AX,4C00h ;terminate program and return to DOS using
- INT 21h ;interrupt 21h function 4CH
-
- .DATA
- StartUpMessage DB "A Simple Input Program$" ;define some messages
- Instructions DB 0Dh,0Ah,"Just press a Y to continue..$" ;newline at beginning
- Thanks DB 0Dh,0Ah,"Thanks for pressing Y!$"
- GoodBye DB 0Dh,0Ah,"Have a nice day!$"
-
- END MAIN